package com.eaoa.uc.busorder.action;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.eaoa.base.EABaseAction;
import com.eaoa.query.bus.BusOrderQuery;
import com.eaoa.uc.busorder.bo.BusOrderChangeBillStatusBO;
import com.eaoa.vo.bus.BusOrder;
import com.stony.core.util.CoreUtils;

public class BusOrderChangeBillStatusAjaxAction extends EABaseAction{

	protected ActionForward doWork(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		Long orderno = CoreUtils.parseLong(request.getParameter("orderno"));
		String status = request.getParameter("status");
		
		try {			
			new BusOrderChangeBillStatusBO(orderno, status).execute();
		} catch (RuntimeException e) {
			e.printStackTrace();
		}finally{
			BusOrder order = BusOrderQuery.loadByNo(orderno);
			status = order.getBillstatus();
			PrintWriter out = response.getWriter();
			out.write(status);
			out.flush();
			out.close();
		}
		
		return null;
	}
}
